class StringExtractor {

    public static void main(String[] args) {
        String input = "一般学习一门编程语言的时候，基本上第一个程序是输出\"Hello World!\"\"";
        System.out.println(extractStrings(input));
    }

    public static String extractStrings(String input) {
        StringBuilder result = new StringBuilder();
        boolean inString = false;
        boolean escape = false;
        int startIndex = -1;

        for (int i = 0; i < input.length(); i++) {
            char c = input.charAt(i);

            if (escape) {
                if (startIndex != -1) {
                    result.append(c);
                }
                escape = false;
            } else {
                if (c == '"') {
                    if (!inString) {
                        inString = true;
                        startIndex = result.length();
                    } else {
                        inString = false;
                        if (startIndex != -1) {
                            result.setLength(result.length() - 1);
                            String extracted = result.substring(startIndex, result.length());
                            result.setLength(startIndex);
                            result.append(extracted);
                        }
                    }
                } else if (c == '\\' && !inString) {
                    escape = true;
                } else if (inString) {
                    result.append(c);
                }
            }
        }

        if (inString) {

        }

        return result.toString();
    }
}